# _*_ coding：UTF-8 _*_
# 开发人员：lgm
# 开发时间：2021/6/17 18:21
# 文件名称：NO_3.PY
# 开发工具：PyCharm
import time
from random import randint
from selenium.webdriver.common.by import By
from new_project.xiangmu_methd import NO_2

d3_sum1 = 15
d3_sum2 = 30
d3_sum3 = 20
d3_sum4 = 20
d3_sum5 = 25
d3_sum6 = 25
d3_sum7 = 25
d3_sum8 = 40
d3_sum9 = 35
d3_sum10 = 30
d3_sum11 = 35
d3_sum12 = 50
d3_sum13 = 20

d3_list1 = []
d3_list2 = []
d3_list3 = []
d3_list4 = []
d3_list5 = []
d3_list6 = []
d3_list7 = []
d3_list8 = []
d3_list9 = []
d3_list10 = []
d3_list11 = []
d3_list12 = []
d3_list13 = []








class StartOj3:
    def __init__(self,driver):
        self.driver = driver

    def disanxiang(self):
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div/div/ul[1]/li[3]").click()  # 第二项
        time.sleep(1)
        for i in range(3):
            nub = randint(1, 5)
            """     
            / html / body / div[4] / div[2] / div / ul / li[1] / div / div / ul / li[2]
            / html / body / div[4] / div[2] / div / ul / li[2] / div / div / ul / li[6]"""
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[2]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list1.append(str(nub))

        print("第三章第一小节得分明细：", d3_list1)
        d3_a_sum1 = 0
        for i in d3_list1:
            d3_a_sum1 += int(i)
        print("第三章第一小节总得分：", d3_a_sum1)
        d3_a_result1 = float(d3_a_sum1) / float(d3_sum1) * 0.068
        print("第三章第一小节权重：", d3_a_result1)

        '''
        第二小节
        '''

        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[3]/p").click() #展开菜单
        time.sleep(1)
        for i in range(6):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[3]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list2.append(str(nub))

        print("第三章第二小节得分明细：", d3_list2)
        d3_a_sum2 = 0
        for i in d3_list2:
            d3_a_sum2 += int(i)
        print("第三章第二小节总得分：", d3_a_sum2)
        d3_a_result2 = float(d3_a_sum2) / float(d3_sum2) * 0.0635
        print("第三章第二小节权重：", d3_a_result2)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[4]/p").click()
        time.sleep(1)
        '''
        第三小节
        '''
        for i in range(4):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[4]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list3.append(str(nub))

        print("第三章第三小节得分明细：", d3_list3)
        d3_a_sum3 = 0
        for i in d3_list3:
            d3_a_sum3 += int(i)
        print("第三章第三小节总得分：", d3_a_sum3)
        d3_a_result3 = float(d3_a_sum3) / float(d3_sum3) * 0.044
        print("第三章第三小节权重：", d3_a_result3)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[5]/p").click()   #第二个div要跟着+1
        time.sleep(1)
        '''
        第四小节
        '''


        for i in range(4):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[5]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list4.append(str(nub))

        print("第三章第四小节得分明细：", d3_list4)
        d3_a_sum4 = 0
        for i in d3_list4:
            d3_a_sum4 += int(i)
        print("第三章第四小节总得分：", d3_a_sum4)
        d3_a_result4 = float(d3_a_sum4) / float(d3_sum4) * 0.05
        print("第三章第四小节权重：", d3_a_result4)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[6]/p").click()   #第二个div要跟着+1
        time.sleep(1)
        '''
        第五小节
        '''

        for i in range(5):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[6]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list5.append(str(nub))

        print("第三章第五小节得分明细：", d3_list5)
        d3_a_sum5 = 0
        for i in d3_list5:
            d3_a_sum5 += int(i)
        print("第三章第五小节总得分：", d3_a_sum5)
        d3_a_result5 = float(d3_a_sum5) / float(d3_sum5) * 0.0608
        print("第三章第五小节权重：", d3_a_result5)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[7]/p").click()   #第二个div要跟着+1
        time.sleep(1)

        '''
        第六小节
        '''

        for i in range(5):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[7]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list6.append(str(nub))

        print("第三章第六小节得分明细：", d3_list6)
        d3_a_sum6 = 0
        for i in d3_list6:
            d3_a_sum6 += int(i)
        print("第三章第六小节总得分：", d3_a_sum6)
        d3_a_result6 = float(d3_a_sum6) / float(d3_sum6) * 0.0784
        print("第三章第六小节权重：", d3_a_result6)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[8]/p").click()   #第二个div要跟着+1
        time.sleep(1)



        '''
        第七小节
        '''

        for i in range(5):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[8]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list7.append(str(nub))

        print("第三章第七小节得分明细：", d3_list7)
        d3_a_sum7 = 0
        for i in d3_list7:
            d3_a_sum7 += int(i)
        print("第三章第七小节总得分：", d3_a_sum7)
        d3_a_result7 = float(d3_a_sum7) / float(d3_sum7) * 0.0519
        print("第三章第七小节权重：", d3_a_result7)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[9]/p").click()   #第二个div要跟着+1
        time.sleep(1)


        '''
        第八小节
        '''

        for i in range(8):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[9]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list8.append(str(nub))

        print("第三章第八小节得分明细：", d3_list8)
        d3_a_sum8 = 0
        for i in d3_list8:
            d3_a_sum8 += int(i)
        print("第三章第八小节总得分：", d3_a_sum8)
        d3_a_result8 = float(d3_a_sum8) / float(d3_sum8) * 0.0917
        print("第三章第八小节权重：", d3_a_result8)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[10]/p").click()   #第二个div要跟着+1
        time.sleep(1)

        '''
        第九小节
        '''

        for i in range(7):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[10]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list9.append(str(nub))

        print("第三章第九小节得分明细：", d3_list9)
        d3_a_sum9 = 0
        for i in d3_list9:
            d3_a_sum9 += int(i)
        print("第三章第九小节总得分：", d3_a_sum9)
        d3_a_result9 = float(d3_a_sum9) / float(d3_sum9) * 0.0781
        print("第三章第九小节权重：", d3_a_result9)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[11]/p").click()   #第二个div要跟着+1
        time.sleep(1)



        '''
        第十小节
        '''

        for i in range(6):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[11]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list10.append(str(nub))

        print("第三章第十小节得分明细：", d3_list10)
        d3_a_sum10 = 0
        for i in d3_list10:
            d3_a_sum10 += int(i)
        print("第三章第十小节总得分：", d3_a_sum10)
        d3_a_result10 = float(d3_a_sum10) / float(d3_sum10) * 0.1028
        print("第三章第十小节权重：", d3_a_result10)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[12]/p").click()   #第二个div要跟着+1
        time.sleep(1)



        '''
        第十一小节
        '''

        for i in range(7):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[12]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list11.append(str(nub))

        print("第三章第十一小节得分明细：", d3_list11)
        d3_a_sum11 = 0
        for i in d3_list11:
            d3_a_sum11 += int(i)
        print("第三章第十一小节总得分：", d3_a_sum11)
        d3_a_result11 = float(d3_a_sum11) / float(d3_sum11) * 0.1225
        print("第三章第十一小节权重：", d3_a_result11)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[13]/p").click()   #第二个div要跟着+1
        time.sleep(1)


        '''
        第十二小节
        '''

        for i in range(10):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[13]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list12.append(str(nub))

        print("第三章第十二小节得分明细：", d3_list12)
        d3_a_sum12 = 0
        for i in d3_list12:
            d3_a_sum12 += int(i)
        print("第三章第十二小节总得分：", d3_a_sum12)
        d3_a_result12 = float(d3_a_sum12) / float(d3_sum12) * 0.102
        print("第三章第十二小节权重：", d3_a_result12)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/div[14]/p").click()   #第二个div要跟着+1
        time.sleep(1)


        '''
        第十三小节
        '''

        for i in range(4):
            nub = randint(1, 5)
            self.driver.find_element_by_xpath(
                "/html/body/div[2]/div[14]/div/ul/li[" + str(i + 1) + "]/div/div/ul/li[" + str(nub + 1) + "]").click()
            d3_list13.append(str(nub))

        print("第三章第十三小节得分明细：", d3_list13)
        d3_a_sum13 = 0
        for i in d3_list13:
            d3_a_sum13 += int(i)
        print("第三章第十三小节总得分：", d3_a_sum13)
        d3_a_result13 = float(d3_a_sum13) / float(d3_sum13) * 0.0863
        print("第三章第十三小节权重：", d3_a_result13)


        print("")
        quanzhongxishu = d3_a_result1 + d3_a_result2 + d3_a_result3 + d3_a_result4 + d3_a_result5 + d3_a_result6+d3_a_result7+d3_a_result8+d3_a_result9+d3_a_result10+d3_a_result11+d3_a_result12+d3_a_result13
        print("权重系数总和", quanzhongxishu)

        d3_result = int(round((quanzhongxishu) * 300,0))
        print("最后结果：", d3_result)
        time.sleep(5)
        self.driver.find_element(By.XPATH, "/html/body/div[2]/input").click()
        time.sleep(2)
        d3_data = self.driver.find_element(By.XPATH, "/html/body/div[2]/div[1]/p").text
        result_data = d3_data.split(" ")
        xitong_fen = result_data[0]



        print("系统最总合计得分：", xitong_fen)
        self.driver.find_element(By.XPATH,"/html/body/div[2]/div[4]/input[2]").click()
        self.driver.implicitly_wait(20)
        return d3_result,d3_list1,d3_list2,d3_list3,d3_list4,d3_list5,d3_list6,d3_list7,d3_list8,d3_list9,d3_list10,d3_list11,d3_list12,d3_list13